import { createGlobalState } from '@peng_kai/kit/libs/vueuse';

export const useFirstRechargeTips = createGlobalState(() => {
  const luckSpinShow = ref(false);
  const luckySpinFirstTipsState = reactive({
    clickClose: false,
    clickSelf: false,
    unRecharge: false,
    initial: false,
  });

  const invitedSpinShow = ref(false);

  watch(() => luckySpinFirstTipsState, (c) => {
    if ([c.clickClose, c.clickSelf].includes(true)) {
      luckSpinShow.value = false;
    }
    if ([c.unRecharge, c.initial].includes(true)) {
      luckSpinShow.value = true;
    }
    for (const key in luckySpinFirstTipsState) {
      luckySpinFirstTipsState[key] = false;
    }
  }, { deep: true });

  return {
    luckSpinShow,
    invitedSpinShow,
    luckySpinFirstTipsState,
  };
});
